#include "widget.h"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
{
    this->setFixedSize(600, 550);

    WebsocketServer* wsServer = WebsocketServer::getInstance();

    QPushButton* sendMsgBtn = new QPushButton("send msg to client", this);
    sendMsgBtn->move(200, 50);
    connect(sendMsgBtn, &QPushButton::clicked, this, [=](){
        emit wsServer->sendMessageToClient();
    });

    QPushButton* deleteFriendBtn = new QPushButton("delete friend", this);
    deleteFriendBtn->move(200, 100);
    connect(deleteFriendBtn, &QPushButton::clicked, this, [=](){
        emit wsServer->sendDeleteFriendToClient();
    });

    QPushButton* friendApplyBtn = new QPushButton("add friend apply", this);
    friendApplyBtn->move(200, 150);
    connect(friendApplyBtn, &QPushButton::clicked, this, [=](){
        emit wsServer->sendFriendApplyToClient();
    });

    QPushButton* agreeFriendApply = new QPushButton("agree friend apply", this);
    agreeFriendApply->move(200, 200);
    connect(agreeFriendApply, &QPushButton::clicked, this, [=](){
        emit wsServer->agreeFriendApplyToClient();
    });

    QPushButton* rejectFriendApply = new QPushButton("reject friend apply", this);
    rejectFriendApply->move(200, 250);
    connect(rejectFriendApply, &QPushButton::clicked, this, [=](){
        emit wsServer->rejectFriendApplyToClient();
    });

    QPushButton* newChatSessionBtn = new QPushButton("create new chat session", this);
    newChatSessionBtn->move(200, 300);
    connect(newChatSessionBtn, &QPushButton::clicked, this, [=](){
        emit wsServer->createChatSessionToClient();
    });
}

Widget::~Widget() {}
